import {
  VuexModule,
  Module,
  Action,
  Mutation,
  getModule,
} from "vuex-module-decorators";
import store from "@/store";

export interface IUserState {
  token: string;
  name: string;
}

@Module({ dynamic: true, store, name: "user" })
class User extends VuexModule implements IUserState {
  public token =  "sikozjxcolmaksop";
  public name = "";


  @Mutation
  private SET_TOKEN(token: string) {
    this.token = token;
  }

  @Mutation
  private SET_NAME(name: string) {
    this.name = name;
  }
  @Action
  public setToken(token: string) {
    this.SET_TOKEN(token);
  }
}

export const UserModule = getModule(User);
